package com.yuyue.springFramework.note07.entity;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * 定义配置类4，在符合MyCondition2条件时，注册实现类2
 */
@Configuration
public class Configuration4 {

    //以Iservice的实现类是否存在作为判断条件
    @Conditional(MyCondition2.class)
    @Bean
    public IService service2(){
        //以第二个实现类作为返回
        return new Service2();
    }

}
